package practice;

import java.util.Random;

public class 开发验证码{
    public static void main(String[] args) {
        System.out.println(creaeCode(6  ));
    }
    public static String creaeCode(int n){
        Random r = new Random();
        String code = "";
        for (int i = 0; i <n; i++) {
            int type = r.nextInt(3);
            switch (type) {
                case 0:
                    code += r.nextInt(10);
                    break;
                case 1:
                    code += (char)('a' + r.nextInt(26));
                    break;
                case 2:
                    code += (char)('A' + r.nextInt(26));
                    break;
            }
        }
        return code;
    }
}